import React from 'react'
import { createBehavior, createResource } from '@designable/core'
import { DnFC } from '@designable/react'
import { createFieldSchema } from '../Field'
import { AllSchemas } from '../../schemas'
import { AllLocales } from '../../locales'
import { ButtonUploadExcel as I18nButtonUploadExcel } from '../../customComponents'

export const ButtonUploadExcel: DnFC<
  React.ComponentProps<typeof I18nButtonUploadExcel>
> = I18nButtonUploadExcel

ButtonUploadExcel.Behavior = createBehavior({
  name: 'ButtonUploadExcel',
  extends: ['Field'],
  selector: (node) => node.props['x-component'] === 'ButtonUploadExcel',
  designerProps: {
    propsSchema: createFieldSchema(AllSchemas.ButtonUploadExcel),
  },
  designerLocales: AllLocales.ButtonUploadExcel,
})

ButtonUploadExcel.Resource = createResource({
  icon: 'ButtonSource',
  elements: [
    {
      componentName: 'Field',
      props: {
        type: 'string',
        title: 'ButtonUploadExcel',
        'x-decorator': 'FormItem',
        'x-component': 'ButtonUploadExcel',
        'x-component-props': {
          buttonText: '导入用户',
        },
      },
    },
  ],
})
